package com.hengpeng.common.persist;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;

import org.hibernate.annotations.Index;

import com.hengpeng.common.persist.entity.AbstractEntity;
import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputType;

/**
 * <pre>
 * 自动定投投注记录
 * </pre>
 * @author zhaojitao
 * @version 1.0, 2010-9-1
 */
@Entity
public class AutoBetRecord extends AbstractEntity
{
	/**
	 * <pre>
	 * 投注状态（由于自动定投真接出票时再写入些表，所以状态是由出票中开始的）
	 * </pre>
	 * @author zhaojitao
	 * @version 1.0, 2010-7-20
	 */
	public static enum BetState
	{
		/**
		 * 等待付款
		 */
		WAITINGPAY("等待付款"),
		/**
		 * 已退单
		 */
		CANCLE("已退单"),
		/**
		 * 出票失败
		 */
		FAILED("出票失败"),
		/**
		 * 出票中
		 */
		PROCESS("出票中"),
		/**
		 * 出票成功
		 */
		SUCCESS("出票成功");

		private String text;

		BetState(String text)
		{
			this.text = text;
		}

		public String getText()
		{
			return text;
		}

		public void setText(String text)
		{
			this.text = text;
		}
	}

	private static final long serialVersionUID = -8363238273338456979L;

	/**
	 * 投注卡号
	 */
	@HtmlInput(label = "投注卡号", type = HtmlInputType.LABEL, index = 3)
	private String betCardNo;

	/**
	 * 投注号码
	 */
	@Lob
	@HtmlInput(label = "投注号码", type = HtmlInputType.LABEL, index = 7)
	private String codeDetail;

	/**
	 * 描述
	 */
	private String description;

	/**
	 * 玩法ID
	 */
	@HtmlInput(label = "玩法ID", type = HtmlInputType.LABEL, index = 4)
	private Integer gameId;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "autoBetRecord")
	@SequenceGenerator(name = "autoBetRecord", sequenceName = "seq_autoBetRecord", allocationSize = SEQALLOCATIONSIZE, initialValue = SEQINITNUM)
	@HtmlInput(type = HtmlInputType.AUTOID)
	private Long id;

	/**
	 * 方案派奖完成后的统计
	 */
	@Column(length = 10)
	@Enumerated(javax.persistence.EnumType.STRING)
	private BoolValue isBonusStatistics;

	/**
	 * 方案成功后的统计
	 */
	@Column(length = 10)
	@Enumerated(javax.persistence.EnumType.STRING)
	private BoolValue isSuccessStatistics;

	/**
	 * 　期号
	 */
	@Index(name = "IDX_Auto_IssueName")
	@HtmlInput(label = "期号", type = HtmlInputType.LABEL, index = 6)
	private String issueName;

	/**
	 * 是否中奖
	 */
	@Column(length = 10)
	@Enumerated(javax.persistence.EnumType.STRING)
	@HtmlInput(label = "是否中奖", type = HtmlInputType.LABEL, labelProperty = "text", index = 10)
	private BoolValue isWin;

	/**
	 * 投注金额
	 */
	// @HtmlInput(label = "投注金额", type = HtmlInputType.LABEL, index = 7)
	private Integer money;

	/**
	 * 投注方案ID
	 */
	@Index(name = "IDX_Auto_PlanId")
	@HtmlInput(label = "方案ID", type = HtmlInputType.LABEL, index = 1)
	private Long planId;

	/**
	 * 购买倍数
	 */
	@HtmlInput(label = "购买倍数", type = HtmlInputType.LABEL, index = 8)
	private Integer playTimes;

	/**
	 * 投注方式
	 */
	@HtmlInput(label = "投注方式", type = HtmlInputType.LABEL, index = 5)
	private Integer playType;

	/**
	 * 中奖金额
	 */
	// @HtmlInput(label = "中奖金额", type = HtmlInputType.LABEL, index = 11)
	private Integer prizeMoney;

	/**
	 * 投注状态
	 */
	@Column(length = 20)
	@Enumerated(javax.persistence.EnumType.STRING)
	@HtmlInput(label = "投注状态", type = HtmlInputType.LABEL, labelProperty = "text", index = 12)
	private BetState state;

	/**
	 * 会员店ID
	 */
	@Column(length = 10)
	@HtmlInput(label = "会员店编号", type = HtmlInputType.LABEL, index = 2)
	private String storeId;

	/**
	 * 出票成功时间
	 */
	private Date successTime;

	/**
	 * 投注时间
	 */
	@HtmlInput(label = "投注时间", type = HtmlInputType.LABEL, index = 14)
	private Date time;
	
	/**
	 * 最后一次失败日期
	 */
	@HtmlInput(label = "最后一次失败日期", type = HtmlInputType.LABEL, index = 14)
	private String lastFailedDate;

	@Column(length = 50)
	private String userName;

	/**
	 * 开奖号码
	 */
	@HtmlInput(label = "开奖号码", type = HtmlInputType.LABEL, index = 9)
	private String winningCode;

	public String getBetCardNo()
	{
		return betCardNo;
	}

	public String getCodeDetail()
	{
		return codeDetail;
	}

	public String getDescription()
	{
		return description;
	}

	public Integer getGameId()
	{
		return gameId;
	}

	public Long getId()
	{
		return id;
	}

	public BoolValue getIsBonusStatistics()
	{
		return isBonusStatistics;
	}

	public BoolValue getIsSuccessStatistics()
	{
		return isSuccessStatistics;
	}

	public String getIssueName()
	{
		return issueName;
	}

	public BoolValue getIsWin()
	{
		return isWin;
	}

	/**
	 * @return 最后一次失败日期 
	 */
	public String getLastFailedDate()
	{
		return lastFailedDate;
	}

	public Integer getMoney()
	{
		return money;
	}

	public Long getPlanId()
	{
		return planId;
	}

	public Integer getPlayTimes()
	{
		return playTimes;
	}

	public Integer getPlayType()
	{
		return playType;
	}

	public Integer getPrizeMoney()
	{
		return prizeMoney;
	}

	public BetState getState()
	{
		return state;
	}

	public String getStoreId()
	{
		return storeId;
	}

	public Date getSuccessTime()
	{
		return successTime;
	}

	public Date getTime()
	{
		return time;
	}

	public String getUserName()
	{
		return userName;
	}

	public String getWinningCode()
	{
		return winningCode;
	}

	public void setBetCardNo(String betCardNo)
	{
		this.betCardNo = betCardNo;
	}

	public void setCodeDetail(String codeDetail)
	{
		this.codeDetail = codeDetail;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	public void setGameId(Integer gameId)
	{
		this.gameId = gameId;
	}

	public void setId(Long id)
	{
		this.id = id;
	}

	public void setIsBonusStatistics(BoolValue isBonusStatistics)
	{
		this.isBonusStatistics = isBonusStatistics;
	}

	public void setIsSuccessStatistics(BoolValue isSuccessStatistics)
	{
		this.isSuccessStatistics = isSuccessStatistics;
	}

	public void setIssueName(String issueName)
	{
		this.issueName = issueName;
	}

	public void setIsWin(BoolValue isWin)
	{
		this.isWin = isWin;
	}

	/**
	 * @param lastFailedDate 最后一次失败日期
	 */
	public void setLastFailedDate(String lastFailedDate)
	{
		this.lastFailedDate = lastFailedDate;
	}

	public void setMoney(Integer money)
	{
		this.money = money;
	}

	public void setPlanId(Long planId)
	{
		this.planId = planId;
	}

	public void setPlayTimes(Integer playTimes)
	{
		this.playTimes = playTimes;
	}

	public void setPlayType(Integer playType)
	{
		this.playType = playType;
	}

	public void setPrizeMoney(Integer prizeMoney)
	{
		this.prizeMoney = prizeMoney;
	}

	public void setState(BetState state)
	{
		this.state = state;
	}

	public void setStoreId(String storeId)
	{
		this.storeId = storeId;
	}

	public void setSuccessTime(Date successTime)
	{
		this.successTime = successTime;
	}

	public void setTime(Date time)
	{
		this.time = time;
	}

	public void setUserName(String userName)
	{
		this.userName = userName;
	}

	public void setWinningCode(String winningCode)
	{
		this.winningCode = winningCode;
	}
}
